<template><div><div class="language-shell line-numbers-mode has-collapsed-lines collapsed" data-highlighter="shiki" data-ext="shell" style="--vp-collapsed-lines:15;background-color:#282c34;color:#abb2bf"><pre class="shiki one-dark-pro vp-code" v-pre=""><code><span class="line"><span style="color:#7F848E;font-style:italic">#!/usr/bin/env sh</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># 确保脚本抛出遇到的错误</span></span>
<span class="line"><span style="color:#56B6C2">set</span><span style="color:#D19A66"> -e</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># 生成静态文件</span></span>
<span class="line"><span style="color:#61AFEF">npm</span><span style="color:#98C379"> run</span><span style="color:#98C379"> build</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># 进入生成的文件夹</span></span>
<span class="line"><span style="color:#56B6C2">cd</span><span style="color:#98C379"> docs/.vuepress/dist</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># 如果是发布到自定义域名</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># echo 'www.example.com' > CNAME</span></span>
<span class="line"></span>
<span class="line"><span style="color:#61AFEF">git</span><span style="color:#98C379"> init</span></span>
<span class="line"><span style="color:#61AFEF">git</span><span style="color:#98C379"> add</span><span style="color:#D19A66"> -A</span></span>
<span class="line"><span style="color:#61AFEF">git</span><span style="color:#98C379"> commit</span><span style="color:#D19A66"> -m</span><span style="color:#98C379"> 'deploy'</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># 如果发布到 https://&#x3C;USERNAME>.github.io</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># git push -f git@github.com:&#x3C;USERNAME>/&#x3C;USERNAME>.github.io.git master</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># 如果发布到 https://&#x3C;USERNAME>.github.io/&#x3C;REPO></span></span>
<span class="line"><span style="color:#7F848E;font-style:italic"># git push -f git@github.com:&#x3C;USERNAME>/&#x3C;REPO>.git master:gh-pages</span></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div><div class="collapsed-lines"></div></div></div></template>


